package br.usp.ime.origami.model;

import java.util.HashSet;
import java.util.Set;

public class MovingPoint implements Point {

	private SimplePoint point;

	private double directionAngle;

	private double speed;

	private Set<MovingTriangle> triangles = new HashSet<MovingTriangle>();

	public MovingPoint(SimplePoint point, double directionAngle, double speed) {
		this.point = point;
		this.speed = speed;
		this.directionAngle = directionAngle;
	}

	public double getDirectionAngle() {
		return directionAngle;
	}

	public SimplePoint getPoint() {
		return point;
	}

	public double getSpeed() {
		return speed;
	}

	@Override
	public String toString() {
		return String.format("[MovingPoint %s d:%3.2f s:1.3%f]", point, Math.toDegrees(directionAngle), speed);
	}

	public SimplePoint getPositionAt(double time) {
		return new SimplePoint(this.point.getX() + (speed * time * Math.cos(directionAngle)), this.point.getY()
				+ (speed * time * Math.sin(directionAngle)));
	}

	public double getX() {
		return this.point.getX();
	}

	public double getY() {
		return this.point.getY();
	}

}
